<?php
include('../../__global.php');
//单品最终页下面的转采
class aj_collectGetBrief extends ml_controller {

    private $rid;

    function initParam() {

        $this->rid   = $this->input('rid');

    }

    function checkParam() {

        $this->check_referer();
        if (!ml_tool_resid::is_resid($this->rid)) {
            $this->api_output(ML_RCODE_PARAM,'','wrong rid');
        }


    }

    public function main() {

        $re_model=new ml_model_dbCollectionComment();
        $data=$re_model->getComment($this->rid);


        $uids=array();
        foreach ($data as &$value) {
            $uids[]=$value['uid'];
        }
        $final=array();
        if(!empty($data)){
            $aNicks = ml_tool_nick::uids2nicks($uids);
            $i=0;
            foreach ($data as $v_nick) {
                $final[$i]['nick'] =  Tool_string::un_html($aNicks[$v_nick['uid']]);
                $final[$i]['headPic']=ml_tool_picid::uid2portrait($v_nick['uid'],'sml');
                $final[$i]['rid']=$this->rid;
                $final[$i]['uid']=$v_nick['uid'];
                $i++;
            }
        }
        
        $this->api_output(ML_RCODE_SUCC,$final);

    }


}

new aj_collectGetBrief();